package nccu.dao.hibernate;

import nccu.dao.AccountCodeDao;
import nccu.model.AccountCode;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * This class interacts with Spring's HibernateTemplate to save/delete and
 * retrieve AccountCode objects.
 *
 * @author <a href="mailto:chris.oberle@gmail.com">Chris Oberle</a>
*/
@Repository("accountCodeDao")
public class AccountCodeDaoHibernate extends GenericDaoHibernate<AccountCode, Long> implements AccountCodeDao {

    public AccountCodeDaoHibernate() {
        super(AccountCode.class);
    }

    public List<AccountCode> findByCode(String code) {
        return getHibernateTemplate().find("from AccountCode where code=?", code);
    }
}
